import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useActiveStepIndex = defineStore('activeStepIndex', () => {
  const activeStepIndex = ref(0)
  const nextStep = () => {
    activeStepIndex.value++
  }
  const previousStep = () => {
    activeStepIndex.value--
  }

  return { activeStepIndex, nextStep, previousStep }
})

export const useQuestionIds = defineStore('questionIds', () => {
  const questionIds = ref([])
  const setQuestionIds = (ids) => {
    questionIds.value = ids
  }
  const addQuestionIds = (id) => {
    questionIds.value.push(id)
  }
  const deleteQuestionIds = (id) => {
    questionIds.value = questionIds.value.filter(item => item !== id)
  }
  return { questionIds, setQuestionIds, deleteQuestionIds, addQuestionIds }
})